package com.fc.test.api;

import com.fc.test.service.TAbbJiangjieService;
import com.fc.test.util.JsonUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("apiArticleController")
@Api(value = "协议、声明等")
public class ApiArticleController {

    @Autowired
    private TAbbJiangjieService jiangjieService;

    @ResponseBody
    @PostMapping(value="getArticleInfo",produces = {"application/json; charset=utf-8"})
    @ApiOperation(value = "获取教程、声明等")
    public String getArticleInfo(
            @ApiParam(value = "1-使用教程；2-关于我们；3-免责声明") @RequestParam(value = "type") int type
    ){
        Map<String,Object> resMap = new HashMap<>();
        resMap = jiangjieService.getArticleInfo(type);
        return JsonUtil.jsonMapStr(resMap);
    }

}
